import request from '@/utils/request'
// 常用语 API接口
const std_comwordApi = {
    list: '/std_comword/list',
    save: '/std_comword/save',
    view: '/std_comword/view',
    del: '/std_comword/delete',
    dels: '/std_comword/batchDel',
    output: '/std_comword/output',
    exportExcelTemplate: '/std_comword/exportExcelTemplate',
    importExcel: '/std_comword/importExcel',
    queryList: '/std_comword/queryList'
}

/**
 * 条件查询
 */
export function queryList(content,createuserid) {
    return request({
        url: std_comwordApi.queryList,
        method: 'get', 
        params: {
            content: content,
            createuserid: createuserid
        }
    })
}

/**
 * 导入常用语Excel
 */
export function importExcel(data) {
    var body = new FormData()
    body.append("file", data);
    return request({
        url: std_comwordApi.importExcel,
        headers: { "Content-Type": "multipart/form-data" },
        method: 'post',
        data: body
    })
}

/**
 * 导出常用语Excel模板
 */
export function exportExcelTemplate() {
    return request({
        url: std_comwordApi.exportExcelTemplate,
        method: 'post',
        responseType: 'blob'
    })
}

/**
 * 导出常用语
 */
export function output(data) {
    return request({
        url: std_comwordApi.output,
        method: 'post',
        data: data,
        responseType: 'blob'
    })
}
/**
 * 批量删除常用语
 * @param {*} ids
 */
export function delStd_comwords(ids) {
    return request({
        url: std_comwordApi.dels,
        method: 'post',
        params: { ids }
    })
}
/**
 * 删除常用语
 * @param {*} id
 */
export function delStd_comword(id) {
    return request({
        url: std_comwordApi.del,
        method: 'post',
        params: { id }
    })
}
/**
 * 查看、编辑常用语
 * @param {*} id
 */
export function viewStd_comword(id) {
    return request({
        url: std_comwordApi.view,
        method: 'get',
        params: { id }
    })
}
/**
 * 保存常用语
 * @param {*} body
 */
export function saveStd_comword(body) {
    return request({
        url: std_comwordApi.save,
        method: 'post',
        data: body
    })
}
/**
 * 查询常用语列表
 * @param {*} body
 */
export function queryStd_comwordList(body) {
    return request({
        url: std_comwordApi.list,
        method: 'post',
        data: body
    })
}